package com.hz.filemanager.model.file;

import com.hz.filemanager.expendable_recyclerview.BaseExpandableRecyclerViewAdapter;

import java.io.Serializable;
import java.util.List;

public class VideoFolderBean implements Serializable , BaseExpandableRecyclerViewAdapter.BaseGroupBean<Video>{

    /**当前文件夹的路径*/
    private String dir;
    /**文件夹名*/
    private String name;


    private List<Video> videos;

    public String getDir() {
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
        int lastIndex = dir.lastIndexOf("/");
        this.name = dir.substring(lastIndex + 1);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Video> getVideos() {
        return videos;
    }

    public void setVideos(List<Video> videos) {
        this.videos = videos;
    }

    @Override
    public int getChildCount() {
        if(videos != null)
            return videos.size();
        return 0;
    }

    @Override
    public Video getChildAt(int childIndex) {
        if(videos != null && videos.size()>=childIndex)
            return videos.get(childIndex);
        return null;
    }

    @Override
    public boolean isExpandable() {
        return getChildCount() > 0;
    }
}
